using System;
using System.Text.RegularExpressions;

using Gtk;

namespace Gazebo.Core
{
    public abstract class BasicHighlighter : ILineHighlighter
    {
        public TextTag Tag { get; private set; }
        
        private readonly Regex regex;
        
        protected BasicHighlighter(Regex pattern, string name)
        {
            regex = pattern;
            Tag = new TextTag(name);
        }
        
        public virtual bool IsHighlighted(string chunk)
        {
            return regex.IsMatch(chunk);
        }
    }
}
